using System;
using System.Collections.Generic;
using axCommerce.Data.Interface;

namespace axCommerce.Data
{
	public partial class Customer : ISimpleData
	{
		public CustomerInfo CustomerInfo { get; set; }

		private void FillCustomerInfo()
		{
			if (CustomerInfoId.HasValue) 
				CustomerInfo = CustomerInfo.Get(CustomerInfoId.Value);
		}

		public static List<Customer> GetAllCustomers()
		{
			return Search(new Customer
			              	{
			              		IsDeleted = false
			              	});
		}

		public void Save()
		{
			CreatedDate = DateTime.Now;
			IsDeleted = false;
			
			Insert();
		}

		public void UpdateInstance()
		{
			Update();
		}

		public void MarkAsDeleted()
		{
			IsDeleted = true;

			Update();
		}
	}
}

